package c.a.a.b0;

import c.b.a.a.a;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/* compiled from: KeyPath */
public class e {
    public static final e c = new e("COMPOSITION");
    public final List<String> a;
    public f b;

    public e(String... strArr) {
        this.a = Arrays.asList(strArr);
    }

    public e a(String str) {
        e eVar = new e(this);
        eVar.a.add(str);
        return eVar;
    }

    public final boolean b() {
        List list = this.a;
        return ((String) list.get(list.size() - 1)).equals("**");
    }

    public boolean c(String str, int i) {
        boolean z = false;
        if (i >= this.a.size()) {
            return false;
        }
        Object obj = i == this.a.size() - 1 ? 1 : null;
        String str2 = (String) this.a.get(i);
        if (str2.equals("**")) {
            Object obj2 = (obj == null && ((String) this.a.get(i + 1)).equals(str)) ? 1 : null;
            if (obj2 != null) {
                if (i == this.a.size() - 2 || (i == this.a.size() - 3 && b())) {
                    z = true;
                }
                return z;
            } else if (obj != null) {
                return true;
            } else {
                i++;
                if (i < this.a.size() - 1) {
                    return false;
                }
                return ((String) this.a.get(i)).equals(str);
            }
        }
        Object obj3 = (str2.equals(str) || str2.equals("*")) ? 1 : null;
        if ((obj != null || (i == this.a.size() - 2 && b())) && obj3 != null) {
            z = true;
        }
        return z;
    }

    public int d(String str, int i) {
        if ("__container".equals(str)) {
            return 0;
        }
        if (!((String) this.a.get(i)).equals("**")) {
            return 1;
        }
        if (i != this.a.size() - 1 && ((String) this.a.get(i + 1)).equals(str)) {
            return 2;
        }
        return 0;
    }

    public boolean e(String str, int i) {
        if ("__container".equals(str)) {
            return true;
        }
        if (i >= this.a.size()) {
            return false;
        }
        if (((String) this.a.get(i)).equals(str) || ((String) this.a.get(i)).equals("**") || ((String) this.a.get(i)).equals("*")) {
            return true;
        }
        return false;
    }

    public boolean f(String str, int i) {
        boolean z = true;
        if ("__container".equals(str)) {
            return true;
        }
        if (i >= this.a.size() - 1 && !((String) this.a.get(i)).equals("**")) {
            z = false;
        }
        return z;
    }

    public e g(f fVar) {
        e eVar = new e(this);
        eVar.b = fVar;
        return eVar;
    }

    public String toString() {
        StringBuilder g = a.g("KeyPath{keys=");
        g.append(this.a);
        g.append(",resolved=");
        g.append(this.b != null);
        g.append('}');
        return g.toString();
    }

    public e(e eVar) {
        this.a = new ArrayList(eVar.a);
        this.b = eVar.b;
    }
}
